#include "pch.h"
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>

using namespace std;


class Solution {
public:
	string countAndSay(int n) {
		string last = "1";
		if (n == 1) return last;

		stack<pair<char, int>> stk;
		string temp;
		for (int j = 0;j < n-1;j++)
		{
			stk.push({ last[0],1 });
			for (int i = 1;i < last.length();i++)
			{
				if (last[i] != stk.top().first)
				{
					temp += to_string(stk.top().second);
					temp.push_back(stk.top().first);
					stk.pop();
				}
				else
				{
					stk.top().second++;
				}

				if (stk.empty())
				{
					stk.push({ last[i],1 });
				}
			}

			if (!stk.empty())
			{
				temp += to_string(stk.top().second);
				temp.push_back(stk.top().first);
				stk.pop();
			}
			last = temp;
			temp.clear();
		}
		return last;
	}
};

int main()
{
	int num;
	cin >> num;
	Solution s;
	string res = s.countAndSay(num);
	cout << res << endl;
	return 0;
}